from django.db import models
from django.contrib.auth.models import User
# Create your models here.

class UserProfile(models.Model):
    user=models.OneToOneField(User,unique=True,verbose_name='用户')#外键
    permissions_page=models.CharField(max_length=250) #用户对应的权限
    name=models.CharField(max_length=250)
    imgfile=models.TextField(null=True)
    is_delete = models.IntegerField(default=0)

    class Meta:
        db_table = "u_userprofile"
        # abstract = True

class u_permissions(models.Model):
    p_id = models.BigAutoField(max_length=30, primary_key=True)
    permissions_level = models.IntegerField()#权限级别
    describe = models.CharField(max_length=250) #描述
    is_delete = models.IntegerField(default=0)

    class Meta:
        db_table = "u_permissions"

class u_user_permission(models.Model):
    id = models.BigAutoField(max_length=30, primary_key=True)
    p_level = models.IntegerField()
    u_id = models.IntegerField()
    is_delete = models.IntegerField(default=0)

    class Meta:
        db_table = "u_user_permission"